<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>popularize - 推广</title>
    <link href="__STATIC__/public/css/bootstrap.min.css" rel="stylesheet">
    <link href="__STATIC__/public/fontawesome-free-5.8.2-web/css/all.css" rel="stylesheet">
    <link href="__STATIC__/home/css/index.css" rel="stylesheet">
</head>

<body>
    <header>
        <div class="jumbotron">
            <h1>前台首页</h1>
            <p><a class="btn btn-primary" role="button" href="{:Url('admin/Index/index')}">后台页面</a></p>
            <div>
                <div class="dropdown">
                    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><i class="fas fa-user"></i>&nbsp;{$Think.session.userInfo.username}</button>
                    <div class="dropdown-menu">
                        <a class="dropdown-item" data-toggle="modal" data-target="#userInfo" href="javascript:;">个人信息</a>
                        <a class="dropdown-item" href="{:Url('logout')}">退出登录</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade" id="userInfo">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">个人信息</h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>
                    <div style="text-align: center;" class="modal-body">
                        <p>用户:{$Think.session.userInfo.username}</p>
                        <p>
                            {if $Think.session.userInfo.superiorname == "BOSS"}
                                身份:{$Think.session.userInfo.superiorname}
                            {else /}
                                我的上级:{$Think.session.userInfo.superiorname}
                            {/if}
                        </p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </header>

    <main>
        <div style="background-color: #fff;" class="jumbotron">
            <div class="tree-table">
                <h1>我的下级</h1>
                <table class="table table-condensed table-hover">
                    <thead>
                        <tr>
                            <th>用户</th>
                            <th>收益</th>
                        </tr>
                    </thead>
                    <tbody>
                        {if $trees}
                            {volist name="trees" id="row"}
                                <tr class="parent">
                                    <td><a href="javascript:;"><i class="fas fa-plus"></i>&nbsp;{$row.username}</a></td>
                                    <td></td>
                                </tr>
                                {volist name="$row['child']" id="child"}
                                    <tr style="display: none;" class="child">
                                        <td><a style="cursor: auto;" href="javascript:;">&nbsp;&nbsp;&nbsp;<i class="fas fa-minus"></i>&nbsp;{$child.username}</a></td>
                                        <td>{$child.money}</td>
                                    </tr>
                                {/volist}
                            {/volist}
                        {else /}
                            <td colspan="2">暂无数据</td>
                        {/if}
                    </tbody>
                </table>
            </div>
            <div class="revenues-table">
                <h1>我的工资</h1>
                <table class="table table-condensed table-hover">
                    <thead>
                        <tr>
                            <th>时间</th>
                            <th>用户</th>
                            <th>收入</th>
                            <th>工资</th>
                            <th>收益</th>
                        </tr>
                    </thead>
                    <tbody>
                        {if $revenues}
                            {volist name="revenues" id="row1"}
                                <tr class="parent">
                                    <td><a href="javascript:;"><i class="fas fa-plus"></i>&nbsp;{$row1.months}</a></td>
                                    <td>{$Think.session.userInfo.username}</td>
                                    <td>{$row1.income}</td>
                                    <td>{$row1.wages}</td>
                                    <td></td>
                                </tr>
                                {volist name="$row1['child']" id="row2"}
                                    <tr style="display: none;" class="child">
                                        <td></td>
                                        <td>
                                            {if $row2.username == $Think.session.userInfo.username}
                                                自己
                                            {else /}
                                                {$row2.username}
                                            {/if}
                                        </td>
                                        <td></td>
                                        <td></td>
                                        <td>{$row2.money}</td>
                                    </tr>
                                {/volist}
                            {/volist}
                        {else /}
                            <td colspan="5">暂无数据</td>
                        {/if}
                    </tbody>
                </table>
            </div>
        </div>
    </main>

    <script src="__STATIC__/public/js/jquery-3.4.1.min.js"></script>
    <script src="__STATIC__/public/js/popper.min.js"></script>
    <script src="__STATIC__/public/js/bootstrap.min.js"></script>
    <script src="__STATIC__/home/js/index.js"></script>
</body>

</html>